<?php
class st_frosozoo_gallery_model extends stthememodel{

    public function __construct($config) {
        parent::__construct ( $config );
        $this->setTableName($this->prefix.'st_frosozoo_gallery');
        $this->setPrimaryKey('id');
    }

    public function saveGallery($post) { 
        $upload_data = wp_upload_dir();
        $data = $post;
        $data['id'] = isset($data['id'])? $data['id']:NULL;
        if($data['id'] == NULL){
            $data['add_date'] = time();
        }
        if(substr($data['image'],0,4) != 'http' )
        $data['image'] = $upload_data['url'] . '/' . basename($data['image']); 
        $this->saveRecords($data);
    }


}